;;;    lambda-tube (λ-tube) - A youtube search API and application in scheme.
;;;    Copyright (C) 2008  Abhishek Mishra
;;;
;;;    This program is free software: you can redistribute it and/or modify
;;;    it under the terms of the GNU General Public License as published by
;;;    the Free Software Foundation, either version 3 of the License, or
;;;    (at your option) any later version.

;;;    This program is distributed in the hope that it will be useful,
;;;    but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;;    GNU General Public License for more details.

;;;    You should have received a copy of the GNU General Public License
;;;    along with this program.  If not, see <http://www.gnu.org/licenses/>.

(module lt-about-dialog mzscheme
  (require (lib "mred.ss" "mred") 
           (lib "class.ss") 
           (lib "sendurl.ss" "net")
           "lt-app-details.scm"
           "lt-i18n.scm")
  (provide get-about-dialog)
  
  ;define the get dialog function
  (define (get-about-dialog parent-frame)
    (let* ((aboutd (new dialog% 
                        [parent parent-frame] 
                        [label (format (get-string "ABOUT_TITLE_LABEL") (get-string app-name))]
                        [min-width 200] 
                        [min-height 100]))
           (about-vpanel (new vertical-panel% [parent aboutd] [alignment '(center top)])))
      (new message% 
           [label (format (get-string "APP_NAME_LABEL") (get-string app-name) (get-string app-version))] 
           [parent about-vpanel]
           [font (make-object font% 12 'default)])
      (new message% [label (format (get-string "COPYRIGHT_LABEL") (get-string author))] [parent about-vpanel])
      (new message% [label (get-string "ONE_LINE_DESCRIPTION_LABEL")] [parent about-vpanel])
      (new message% [label (get-string "DEVELOPED_USING_ONE_LINE")] [parent about-vpanel])
      (let ((license-info (get-string "LICENSE_INFO")))
        (new text-field% 
             [label ""] 
             [init-value license-info] 
             [parent about-vpanel] 
             [style '(multiple)] 
             [min-width 100] 
             [stretchable-width #f]))
      
      (let ((button-hpanel (new horizontal-panel% [parent about-vpanel] [alignment '(center center)])))
        (new button% 
             [label (get-string "LICENSE_BUTTON_LABEL")] 
             [min-width 100]
             [parent button-hpanel] 
             (callback (lambda (button event)
                         (send-url "http://www.gnu.org/licenses/gpl.html"))))
        (new button% 
             [label (get-string "PLT_SCHEME_BUTTON_LABEL")] 
             [min-width 100]
             [parent button-hpanel] 
             (callback (lambda (button event)
                         (send-url "http://www.plt-scheme.org/"))))
        (new button% 
             [label (get-string "LAMBDA_TUBE_HOMEPAGE_LABEL")] 
             [min-width 100]
             [parent button-hpanel] 
             (callback (lambda (button event)
                         (send-url "http://code.google.com/p/lambda-tube/"))))
        (new button% 
             [label (get-string "OK_BUTTON_LABEL")] 
             [min-width 100]
             [parent button-hpanel] 
             (callback (lambda (button event)
                         (send (send button get-top-level-window) show #f)))))
      
      aboutd
      )
    )
  )